package org.example.kidscode.entity;

import lombok.Data;
import javax.persistence.*;
import java.time.LocalDateTime;

@Data
@Entity
@Table(name = "course")
public class Course {

    @Id
    @Column(name = "course_id", length = 20)
    private String courseId;

    @Column(name = "course_name", length = 50, nullable = false)
    private String courseName;

    @Column(name = "teacher_id", length = 20)
    private String teacherId;

    @Column(name = "course_type", length = 20, nullable = false)
    private String courseType;

    @Column(name = "level", length = 20, nullable = false)
    private String level;

    @Column(name = "description", columnDefinition = "text")
    private String description;

    @Column(name = "total_hours", columnDefinition = "smallint(5) unsigned default 16")
    private Integer totalHours = 16;

    @Column(name = "class_time", columnDefinition = "json")
    private String classTime; // 直接使用String类型

    @Column(name = "classroom", length = 30)
    private String classroom;

    @Column(name = "max_students", columnDefinition = "smallint(5) unsigned default 10")
    private Integer maxStudents = 10;

    @Column(name = "current_students", columnDefinition = "smallint(5) unsigned default 0")
    private Integer currentStudents = 0;

    @Column(name = "status", columnDefinition = "tinyint(1) default 1")
    private Boolean status = true;

    @Column(name = "create_time", columnDefinition = "datetime default CURRENT_TIMESTAMP")
    private LocalDateTime createTime;

    @Column(name = "update_time", columnDefinition = "datetime default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP")
    private LocalDateTime updateTime;
}
